<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div>
        <h1>{{info}}</h1>
        <input type="button" value="测试异步请求get" @click="f1()">
        <input type="button" value="测试异步请求post" @click="f2()">
    </div>
    <script src="js/vue.js"></script>
    <script src="js/axios.min.js"></script>
    <script>
        let v = new Vue({
            el:"div",
            data:{
                info:"测试Vue!"
            },
            methods:{
                f1(){
                    axios.get("/hello1Axios?info=tom").then(function (response) {
                        //response代表服务器的响应对象
                        //response.data代表服务器响应的数据
                        alert(response.data);
                    })
                },
                f2(){
                    //发出异步post请求
                    axios.post("/hello2Axios",{info:"刘德华"}).then(function (response) {
                        alert(response.data);
                    })
                }
            }
        })
    </script>
</body>
</html>